﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

public class Solution198
{
	public int Rob(int[] nums)
	{
		int len=nums.Length;
		int[] dp = nums;
		if (len == 0)
		{
			return 0;
		}
		if(len == 1)
		{
            dp[0] = nums[0];
			return dp[0];
        }

		dp[1] = Math.Max(nums[1], nums[0]);
			
        
		
		


    for (int i=2;i<nums.Length;i++)
		{

			dp[i] = Math.Max(dp[i - 1], dp[i - 2] + nums[i]);
		
		}
	return dp[nums.Length-1];

	}





}

class Program198
{
	 static void Main198(string[] args)
	{

        Solution198 solution = new Solution198();
		
        int[] nums = { 0 };
        int result = solution.Rob(nums);
        Console.WriteLine("Maximum amount: " + result);
		Console.ReadKey();
    }
}
